#ifndef TETRIXPIECE_H
#define TETRIXPIECE_H

#include <QBitArray>
#include <QColor>

namespace Ui {
    class TetrixPiece;
}

class TetrixPiece
{
public:
    TetrixPiece();
    TetrixPiece(int [],int rows,int cols, QColor color = Qt::green);
    //TetrixPiece(const TetrixPiece &piece);

    const QColor& color() const {return _color;}
    void  setColor(const QColor &color) {_color = color;}

    int width() const {return _col_per_row;}
    int height() const {return _col_per_row > 0 ? _array.size() / _col_per_row : 0;}
    int size()  const {return width() * height();}

    bool isFilled(int row,int col) const;
    bool isFilled(int index) const;

    void clean();
    void rotateLeft();

private:
    QBitArray   _array;
    QColor      _color;
    int         _col_per_row;
};

#endif // TETRIXPIECE_H
